﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DailyComics.Common.Model.Storage
{
  public class CacheStorageStrategy : IStoragePutStrategy , IStorageGetStrategy
  {
    private Dictionary<string, IPersistable> cache;

    public CacheStorageStrategy(Dictionary<string, IPersistable> cache)
    {
      this.cache = cache;
    }

    #region ISerializer Members

    public void Put<T>(string name, T obj)
    {
      if (!cache.ContainsKey(name)) cache.Add(name, obj as IPersistable);
    }

    public void PutRange<T>(string name, IEnumerable<T> lst)
    {
      throw new NotImplementedException();
    }

    #endregion

    #region IDeSerializer Members

    public T Put<T>(string name)
    {
      return default(T);
    }

    public IEnumerable<T> PutRange<T>(string name)
    {
      return null;
    }

    #endregion
  }
}
